import {NextRequest,NextResponse} from "next/server"
// export const dynamic = 'auto' //'auto' | 'force-dynamic' | 'error' | 'force-static'
import z from 'zod'
import {createUserSchema, updateUserSchema} from "@/server/db/validate-schema";
const inputSchema = z.object({
    name:z.string().max(10).min(3),
    email:z.string().email()
})
export function GET(request:NextRequest){
    const query = request.nextUrl.searchParams
    const name = query.get('name')
    const email = query.get('email')
    const result = updateUserSchema.safeParse({
        name,email
    })
    if(result.success){
        return  NextResponse.json(result.data);
    }else{
        return  NextResponse.json({error:result.error.message});
    }
}